-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sherlock-72 (continuation - move quote token): Lenders pay deposit fees due to no slippage control #918
Conversation
…es due to no slippage control
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is consistent with the proposed approach.
Assume the lender is already below the LUP, but is trying to move above the LUP. Even if they pass true
, seems they will not get a revert. So the slippage protection is really only for those lenders currently above the LUP?
that's correct. lenders moving from below LUP won't pay deposit fee so slippage control to protect against is not needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright; makes sense.
@@ -290,7 +290,8 @@ contract PositionManager is PermitERC721, IPositionManager, Multicall, Reentranc | |||
uint256 tokenId_, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't revert list be expanded with revertIfBelowLup_
case:
/**
* @inheritdoc IPositionManagerOwnerActions
* @dev External calls to `Pool` contract:
* @dev `bucketInfo()`: get from bucket info
* @dev `moveQuoteToken()`: move liquidity between buckets
* @dev === Write state ===
* @dev `TokenInfo.positionIndexes`: remove from bucket index
* @dev `TokenInfo.positionIndexes`: add to bucket index
* @dev `TokenInfo.positions`: update from bucket position
* @dev `TokenInfo.positions`: update to bucket position
* @dev === Revert on ===
* @dev - `mayInteract`:
* @dev token id is not a valid / minted id
* @dev sender is not owner `NoAuth()`
* @dev token id not minted for given pool `WrongPool()`
* @dev - positions token to burn has liquidity `RemovePositionFailed()`
* @dev - tried to move from bankrupt bucket `BucketBankrupt()`
* @dev === Emit events ===
* @dev - `MoveQuoteToken`
* @dev - `MoveLiquidity`
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the possible underlying reverts are not listed here but only the reverts from function logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description of change
High level
revertIfBelowLup
param added toPool.moveQuoteToken
andPositionManager.moveLiquidity
functiontrue
then the tx will revert if move happens belowLUP
price (hence avoid paying fee).false
move belowLUP
will go through and deposit fee paidMoveQuoteParams
struct moved from inline in order to avoid stack too deep errorPool
contract size by reading structs in view functions only onceContract size
Pre Change
Post Change
Gas usage
Pre Change
Post Change